package org.abacus.platform.database.impl;

import org.abacus.platform.database.Column;
import org.abacus.platform.database.Datasource;
import org.abacus.platform.database.Table;

public class ColumnImpl implements Column {

	/**
	 *
	 */
	private static final long serialVersionUID = 1249213638863554689L;

	private Long id;

	private Table table;

	private Datasource datasource;

	private String columnName;

	private boolean primaryKey = false;

	private String className;

	private String showName;

	private String dataType;

	private String columnType;

	private Integer dataLength;

	private Integer dataScale;

	private boolean nullable = true;

	public Long getId() {
		return id;
	}

	public void setId(Long arg0) {
		id = arg0;
	}

	public Table getTable() {
		return table;
	}

	public void setTable(Table arg0) {
		table = arg0;
	}

	public Datasource getDatasource() {
		return datasource;
	}

	public void setDatasource(Datasource arg0) {
		datasource = arg0;
	}

	public String getColumnName() {
		if (null != columnName) {
			columnName = columnName.toUpperCase();
		}
		return columnName;
	}

	public void setColumnName(String arg0) {
		columnName = arg0;
	}

	public boolean getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(boolean arg0) {
		primaryKey = arg0;
		if (arg0) {
			nullable = !arg0;
		}
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String arg0) {
		className = arg0;
	}

	public String getShowName() {
		return showName;
	}

	public void setShowName(String arg0) {
		showName = arg0;
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String arg0) {
		dataType = arg0;
	}

	public String getColumnType() {
		return columnType;
	}

	public void setColumnType(String arg0) {
		columnType = arg0;
	}

	public Integer getDataLength() {
		return dataLength;
	}

	public void setDataLength(Integer arg0) {
		dataLength = arg0;
	}

	public Integer getDataScale() {
		return dataScale;
	}

	public void setDataScale(Integer arg0) {
		dataScale = arg0;
	}

	public boolean getNullable() {
		return nullable;
	}

	public void setNullable(boolean arg0) {
		nullable = arg0;
	}

}
